#ifndef SPW_CONFIG_H_
#define SPW_CONFIG_H_
#include <type_traits>

namespace spwdetail {
template<typename... Cond>
using Require = typename std::enable_if<std::__and_<Cond...>::value>::type;

// replacefirstarg 第一个参数TC为模版类, U替换TC模版的第一个模版参数
template<typename TC, typename U>
struct ReplaceFirstArg {};

template<template<typename, typename...> class Temp, typename U,
    typename T, typename... Types>
struct ReplaceFirstArg<Temp<T, Types...>, U> {
    using type = Temp<U, Types...>;
};

template<typename TC, typename U>
struct Rebind : ReplaceFirstArg<TC, U>{};

// alloc_rebind
template<typename Alloc, typename U>
using AllocRebind = typename Rebind<Alloc, U>::type;


}// namespace spwdetail

namespace spwconfig {
// size_t 类型为sizeof(xxx)返回值的类型
// size_t = unsigned long
using size_t = decltype(sizeof(unsigned int));
// ptrdiff_t类型为size_t的有符号对应，两个指针相减的类型 
// 用于指针算术，和数组下标的差值
// ptrdiff_t = signed long
using ptrdiff_t = signed long;

using nullptr_t = decltype(nullptr);
} // spwconfig
#endif // SPW_CONFIG_H_
